<h1><%=h @stock.name %>&nbsp;<%=h @stock.market_value %> 
    <% trend = @stock.market_value - @stock.days_opening %>
    <% if trend == 0 %>
    <img src="/images/side.png" height=15px width=15px />
    <% elsif trend < 0 %>
    <img src="/images/down.png" height=15px width=15px />
    <%= -trend %>
    <% else %>
    <img src="/images/up.png" height=15px width=15px />
    <%= trend %>
    <% end %>

<%= link_to 'Buy', 
            :action => 'buy',
            :id      => @stock %> | 
<%= link_to 'Sell', 
            :action => 'sell',
            :id      => @stock %>
    </h1>
<p>
  <%=h @stock.description %>
</p>
<%= image_tag(@stock.name+"_today.png") %>

<h3> 
  <b>Face value:
  <%=h @stock.face_value %></b>
</h3>


<br /><br />
<h2>Stock Triggers</h2>
<br />
<table><tr><td><h3>Buy Triggers</h3></td><td><h3>Sell Triggers</h3></td><tr>
<tr><td>
<table>
  <tr>
    <th>Quanitity</th>
    <th>Price</th>
    <th>Created At</th>
  </tr>

<% for trigger in @buy_triggers %>
  <tr>
    <td><%= trigger.quantity %></td>
    <td><%= trigger.price %></td>
    <td><%= trigger.created_at %></td>
  </tr>
<% end %>
</table>
</td>
<td>
<table>
  <tr>
    <th>Quanitity</th>
    <th>Price</th>
    <th>Created At</th>
  </tr>

<% for trigger in @sell_triggers %>
  <tr>
    <td><%= trigger.quantity %></td>
    <td><%= trigger.price %></td>
    <td><%= trigger.created_at %></td>
  </tr>
<% end %>
</table>
</td></tr>
</table>
    <%= link_to 'Back', :back %>
